<?php

/**
 * Silabo form.
 *
 * @package    sistema_estadisticas
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class SilaboForm extends BaseSilaboForm
{
	public function configure()
	{
		$this->widgetSchema['docente_id'] = new WidgetFormAutocomplete(
			array(
				'action' => 'docente/buscar',
				'model' => 'Docente',
			)
		);

		if (!$this->isNew())
			$this->widgetSchema['docente_id']->setOption('values', array($this->getObject()->getDocente()));

		$this->widgetSchema['observacion'] = new sfWidgetFormTextarea();
		$this->widgetSchema['f_inicio'] = new WidgetFormDatePick();
		$this->widgetSchema['f_finalizacion'] = new WidgetFormDatePick();
		$this->widgetSchema['unidad_id'] =  new WidgetFormUnidad();
		$this->widgetSchema['carrera_id'] = new sfWidgetFormDoctrineChoice(array('model'=>'Carrera', 'order_by' => array('denominacion', 'ASC')));
		$this->widgetSchema->moveField('carrera_id', sfWidgetFormSchema::AFTER, 'docente_id');
		
		$this->validatorSchema['carrera_id'] = new sfValidatorPass();
		$this->validatorSchema->setPostValidator(new ValidatorFechas(array('begin_date_column' => 'f_inicio', 'end_date_column' => 'f_finalizacion')));
		parent::setupAnexoForm();
	}
}
